package com.ddwl.shop.controller;

import com.ddwl.common.annotation.Auth;
import com.ddwl.common.constant.BaseEnum;
import com.ddwl.common.controller.BaseController;
import com.ddwl.schema.bo.shop.ShopRateBo;
import com.ddwl.schema.vo.base.RestVo;
import com.ddwl.shop.service.ShopRateService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * @Author hemiaojun
 * @Date 2021/7/1 15:46
 */
@Api(tags = "店铺评价")
@RequestMapping("/shopRate")
@RestController
public class ShopRateController extends BaseController {


    @Resource
    private ShopRateService shopRateService;


    @PostMapping()
    @Auth(product = {BaseEnum.ProductEnum.FENXIAO, BaseEnum.ProductEnum.MALL, BaseEnum.ProductEnum.WBM, BaseEnum.ProductEnum.BYTE_DANCE, BaseEnum.ProductEnum.WBM_OFFICE})
    @ApiOperation("评价")
    public RestVo shopRate(@Valid @RequestBody ShopRateBo bo){
        bo.setUserId(getUserId());
        bo.setNickname(getUserNameNew());
        shopRateService.rate(bo);
        return RestVo.ok();
    }


}
